<template>
    <div id='temp'>
        <vue-loading class='showingImg' v-if='isshowing' type="bars" color="#d9544e" :size="{ width: '50px', height: '50px' }"></vue-loading>
        <ul v-if='!isshowing' class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for='(item,index) in list' :key="index">
                <router-link v-bind="{to:'/news/newsinfo/'+item.id}">
                    <img class="mui-media-object mui-pull-left" :src="item.img_url">
                    <div class="mui-media-body">
                          {{item.title}}
                        <p class='mui-ellipsis' v-text="item.zhaiyao"></p>
                        <div class="getCTime">
                            <span>{{item.add_time | datefmt('YYYY-MM-DD HH:mm:ss')}}</span>
                            <span>点击次数：{{item.click}}</span>
                        </div>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>
<script>
    import { Toast } from 'mint-ui';
    import common from "../../kits/common.js";
    //导入实现shloadding的子组件
    import vueLoading from 'vue-loading-template';
    export default{
        components:{
            vueLoading,
        },
        data(){
            return {
                list:[],
                isshowing:true,
            }
        },
        created(){
            this.getnews()
        },
        methods:{
            getnews(){
                this.$http.get(common.apidomain+"/api/getnewslist").then(function(res){
                    this.isshowing=false;
                    var data=res.body;
                    if(data.status!=0){
                        Toast(data.message);
                        return;
                    }
                    this.list=data.message;
                })
            }
        },
      

    }

</script>
<style scoped>
    .mui-table-view .mui-media-object{
        max-width:80px;
        max-height:80px;
        height:80px;
    }
    .mui-ellipsis{
        
        font-size:14px;
    }
    .getCTime{
        color:#0094ff;
        margin-top:1em;
        font-size: 12px;
    }
    .getCTime span:last-of-type{
       margin-left:30px;
    } 
    .showingImg{
        width: 100%;
        height: 100%;
    }
    .showingImg svg{
        display: table-cell;
        vertical-align: middle;     
        text-align: center;
    }


    
</style>